home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / Aberrator 3.0 / Install Aberrator 3.0.exe / Install Aberrator 3.0.dxr / 00001_GenericInstaller.ls next >
Encoding:
Text File  |  2007-04-19  |  3.1 KB  |  105 lines

  1. property softwareTitle, srcPath, fileList, destPath, copiedFiles
  2.  
  3. on new me
  4.   me.softwareTitle = "Aberrator 3.0"
  5.   me.srcPath = the moviePath
  6.   me.fileList = ["aberrator30.exe"]
  7.   if the platform contains "mac" then
  8.     me.destPath = baSysFolder("apps") & me.softwareTitle & ":"
  9.   else
  10.     me.destPath = baSysFolder("program files") & me.softwareTitle & "\"
  11.   end if
  12.   me.copiedFiles = []
  13.   return me
  14. end
  15.  
  16. on confirmInstall me
  17.   muiStatLi = [#S1: "This program will install the selected software on your computer"]
  18.   if softwareTitle <> EMPTY then
  19.     muiStatLi[#S1] = "This program will install" && softwareTitle && "on your computer"
  20.   end if
  21.   muiResult = confirmInstallDialog(VOID, VOID, VOID, VOID, muiStatLi, VOID, VOID, VOID, VOID)
  22.   if muiResult[2] = "cancel" then
  23.     exitInstaller()
  24.   end if
  25. end
  26.  
  27. on setDestPath me, startPath
  28.   if (startPath = VOID) or (startPath = EMPTY) then
  29.     if the platform contains "mac" then
  30.       startPath = baSysFolder("apps") & me.softwareTitle & ":"
  31.     else
  32.       startPath = baSysFolder("program files") & me.softwareTitle & "\"
  33.     end if
  34.   end if
  35.   muiResult = installationPathDialog(VOID, VOID, VOID, VOID, VOID, [#installationPathField: startPath], VOID, VOID, VOID)
  36.   case muiResult[2] of
  37.     "cancel":
  38.       exitInstaller()
  39.     "browse":
  40.       newPath = baGetFolder(me.destPath, "Select installation folder", 2, EMPTY, -1, -1)
  41.       setDestPath(me, newPath)
  42.     "OK":
  43.       newPath = muiResult[3][#installationPathField]
  44.       if validatePath(me, newPath) then
  45.         me.destPath = newPath
  46.       else
  47.         baMsgBox("Illegal path entered", "Error", "OK", "exclamation", 1)
  48.         setDestPath(me, newPath)
  49.       end if
  50.   end case
  51. end
  52.  
  53. on performInstall me
  54.   me.copiedFiles = []
  55.   if not baFolderExists(me.destPath) then
  56.     baCreateFolder(me.destPath)
  57.   end if
  58.   if me.fileList.count > 0 then
  59.     repeat with i = 1 to me.fileList.count
  60.       copyResult = baCopyFile(me.srcPath & me.fileList[i], me.destPath & me.fileList[i], "always")
  61.       if copyResult = 0 then
  62.         copiedFiles.add(me.fileList[i])
  63.       end if
  64.     end repeat
  65.   end if
  66.   if me.copiedFiles.count <> me.fileList.count then
  67.     baMsgBox("Some files could not be copied to the specified folder. Please try again", "Error", "OK", "exclamation", 1)
  68.     exitInstaller()
  69.   end if
  70. end
  71.  
  72. on validatePath me, aPath
  73.   lastDelim = the itemDelimiter
  74.   if the platform contains "mac" then
  75.     the itemDelimiter = ":"
  76.   else
  77.     the itemDelimiter = "\"
  78.   end if
  79.   theResult = 1
  80.   if aPath = EMPTY then
  81.     theResult = 0
  82.   end if
  83.   if baDiskList().getOne(aPath.item[1] & the itemDelimiter) = 0 then
  84.     theResult = 0
  85.   end if
  86.   case baDiskInfo(aPath.item[1], "type") of
  87.     "CD-ROM", "floppy", "RAM", "invalid":
  88.       theResult = 0
  89.   end case
  90.   the itemDelimiter = lastDelim
  91.   return theResult
  92. end
  93.  
  94. on addShortcut me
  95.   muiResult = addShortcutDialog()
  96.   if muiResult[2] = "yes" then
  97.     baMakeShortcut(me.destPath & me.fileList[1], baSysFolder("desktop"), me.softwareTitle)
  98.   end if
  99. end
  100.  
  101. on addUninstallInfo me
  102.   uninstallText = "To uninstall this software simply delete this folder"
  103.   baWriteFile(me.destPath & "uninstall info.txt", uninstallText, EMPTY)
  104. end
  105.